﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
<style>
    .aui-list .aui-list-item-label, .aui-list .aui-list-item-label-icon {
        width: 20%;
    }

    .aui-list {
        border-top: 0px solid transparent;
    }

        .aui-list .aui-list-item {
            /*border-bottom: 1px solid transparent;*/
        }
</style>
<div id="header" class="rows-30">
    <div class="rows-30"></div>
    <div class="rows-40">
        <div style="padding: 0 20%"><img src="~/Content/image/towerlogo.png" /></div>
    </div>
    <div class="rows-30"></div>
</div>
<div id="inputInfo" class="rows-70 aui-text-center">
    <div class="rows-40">
        <ul class="aui-list aui-form-list" style="padding:2% 15%;">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        <i id="UserCodeIcon" class="aui-iconfont aui-icon-my aui-font-size-20"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input id='UserCode' type="text" placeholder="请输入帐号" />
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        <i id="UserPwdIcon" class="aui-iconfont aui-icon-display aui-font-size-20"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input id='UserPwd' class="" type="password" placeholder="请输入密码" />
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="rows-10" style="padding: 15%;">
        <p><div id="loginBtn" class="aui-btn aui-btn-danger aui-btn-block">登录系统</div></p>
    </div>
    <div class="rows-10 aui-text-center">
    </div>
    <div class="rows-10 aui-text-center">
        <span class="aui-font-size-12">中国铁塔油机管理系统</span>
    </div>
</div>
<script>
    $(function () {
        $("body").css('background-color', 'white');
        $("#footer").hide();
        //用户登录
        $("#loginBtn").click(function () {
            var userData = {
                UserCode: $("#UserCode").val(),
                UserPwd: $("#UserPwd").val(),
                WxOpenId: '@ViewBag.WxOpenId',
                WxHreadImg: '@ViewBag.WxHreadImg',             
            };
            if (userData.UserCode === "" || userData.UserPwd === "") {
                openDialog(1, "登录失败", "用户名或密码不能为空");
            }
            else {
                $.ajax({
                    url: '/Home/CheckLogin',
                    type: 'post',
                    data: userData,
                    beforeSend: function () {
                        openLoading();
                    },
                    success: function (data) {
                        console.log(data)
                        var result = eval(data);

                        closeLoading();
                        if (result.Code === 1) {
                            //location.href = "/Home/Bind?rand=" + Math.random() + ""; //直接绑定了
                            location.href = "/Home/Menu";

                        } else {
                            openDialog(1, "登录失败", result.Result);
                        }
                    }
                });
            }
        });
    })
</script>
